﻿<UserControl x:Class="TimeSplicerModule.Views.ProjectListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Width="1100" Height="Auto">
    <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="35,0,35,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>

        <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left">
            <controls:MetroAnimatedSingleRowTabControl>
                <!-- Projects -->
                <TabItem Header="Projects">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="60" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                    
                    <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left">
                        <StackPanel Orientation="Horizontal">
                                <Button Name="addButton" Content="Add New" Width="125" Height="25" Click="addButton_Click" IsEnabled="{Binding Path=IsEnabled}" />
                            
                            <TextBlock Text="PM:" Margin="25,0,0,0" Height="25" />
                                <ComboBox Name="users1ComboBox"  Margin="15,0,0,0" ItemsSource="{Binding Path=Users}"
                                          Width="150"
                                          DisplayMemberPath="FullName"
                                          SelectedValuePath="UserGuid"
                                          SelectedValue="{Binding Path=SelectedUserGuid, UpdateSourceTrigger=PropertyChanged}"
                                          SelectionChanged="users1ComboBox_SelectionChanged"
                                          >
                                </ComboBox>

                                <TextBlock Text="Status:" Margin="25,0,0,0" Height="25" />
                                <ComboBox Name="statusesComboBox" ItemsSource="{Binding Path=Statuses}" Margin="15,0,0,0"
                                          Width="150"
                                          DisplayMemberPath="Name"
                                          SelectedValuePath="StatusGuid"
                                          SelectedValue="{Binding Path=SelectedStatusGuid}"
                                          SelectionChanged="statusesComboBox_SelectionChanged">
                                    
                                </ComboBox>

                                <TextBlock Text="Search:" Margin="25,0,0,0" Height="25" />
                                <TextBox Name="search1TextBox" Text="{Binding Path=SearchText, Mode=TwoWay}" Width="200" Margin="15,0,0,0" Height="25" TextChanged="search1TextBox_TextChanged" />
                            </StackPanel>
                    </Border>

                    <!-- TODO: Project List -->
                        <!-- Need to go style this  -->
                        <Border Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left">
                            <ListView ItemsSource="{Binding Path=FilteredProjects}"
                                      ItemTemplate="{StaticResource ProjectListItemTemplate}"
                                      SelectionChanged="DataGrid_SelectionChanged">

                                <ListView.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel ItemWidth="400" ItemHeight="65" Width="800" />
                                        <!--<WrapPanel Width="{Binding (FrameworkElement.ActualWidth), 
                                RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
                                ItemWidth="{Binding (ListView.View).ItemWidth, 
                                RelativeSource={RelativeSource AncestorType=ListView}}"
                                MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
                                ItemHeight="{Binding (ListView.View).ItemHeight, 
                                RelativeSource={RelativeSource AncestorType=ListView}}" />-->
                                    </ItemsPanelTemplate>
                                </ListView.ItemsPanel>

                                <!-- Still more to add -->
                                <!--<DataGrid.Columns>
                                    <DataGridTextColumn Header="Project" Binding="{Binding Path=Name}" />
                                    <DataGridTextColumn Header="Status" Binding="{Binding Path=Status.Name}" />
                                    <DataGridTextColumn Header="Priority" Binding="{Binding Path=Priority.Name}" />
                                    <DataGridTextColumn Header="Project Manager" Binding="{Binding Path=ProjectManager.FullName}" />
                                    <DataGridTextColumn Header="Started Date" Binding="{Binding Path=StartedDate,StringFormat=MM/dd/yyy}"/>
                                    <DataGridTextColumn Header="Due Date" Binding="{Binding Path=DueDate,StringFormat=MM/dd/yyyy}" />
                                </DataGrid.Columns>-->
                            </ListView>
                        </Border>
                        
                        <!-- Pregress Ring -->
                        <Border Name="progressBorder" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Panel.ZIndex="3">
                            <controls:ProgressRing Name="progressRing" VerticalAlignment="Center" HorizontalAlignment="Center" />
                        </Border>
                    </Grid>
                </TabItem>
                
                <!-- Tasks -->
                <!--<TabItem Header="Tasks">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        
                        <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="User:" Margin="25,0,0,0" Height="25" />
                                <ComboBox Margin="15,0,0,0" ItemsSource="{Binding Path=Users}"
                                          Width="150"
                                          DisplayMemberPath="FullName"
                                          SelectedValuePath="UserGuid"
                                          SelectedValue="{Binding Path=SelectedUserGuid, UpdateSourceTrigger=PropertyChanged}"
                                          >
                                </ComboBox>

                                <TextBlock Text="Status:" Margin="25,0,0,0" Height="25" />
                                <ComboBox Name="taskStatusesComboBox" ItemsSource="{Binding Path=TaskStatuses}" Margin="15,0,0,0"
                                          Width="150"
                                          DisplayMemberPath="Name"
                                          SelectedValuePath="StatusGuid"
                                          SelectedValue="{Binding Path=SelectedTaskStatusGuid}">

                                </ComboBox>

                                <TextBlock Text="Search:" Margin="25,0,0,0" Height="25" />
                                <TextBox Text="{Binding Path=SearchText}" Width="200" Margin="15,0,0,0" Height="25" />

                                <Button Name="searchButton2" Content="Search" Width="125" Height="25" Click="searchButton2_Click"  Margin="25,0,0,0" />
                            </StackPanel>



                        </Border>


                        <Border Grid.Column="0" Grid.Row="1" Margin="5">
                            <ListView ItemsSource="{Binding Path=FilteredTasks}"
                                      ItemTemplate="{StaticResource ResourceKey=TaskListItemTemplate}">

                                --><!--<DataGrid.Columns>
                                    -->
                                <!--<DataGridTextColumn Header="Status" Binding="{Binding Path=Name}"/>
                                    <DataGridTextColumn Header="Description" Binding="{Binding Path=Description}"/>-->
                                <!--
                                </DataGrid.Columns>--><!--
                            </ListView>
                        </Border>
                    </Grid>
                </TabItem>-->
            </controls:MetroAnimatedSingleRowTabControl>
        </Border>
    </Grid>
</UserControl>